﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Ocmf.Types;

namespace Ocmf.Forms
{
    public partial class EditBuzzerActionForm : Form
    {
        public Buzzer Buzzer { get; set; }

        public EditBuzzerActionForm(Buzzer buzzer)
        {
            InitializeComponent();
            Buzzer = buzzer;
            numericUpDownDuration.Value = new decimal(Buzzer.Duration);
            radioButtonPulse.Checked = Buzzer.Pulse;
            radioButtonConstant.Checked = !Buzzer.Pulse;
        }

        private void buttonOk_Click(object sender, EventArgs e)
        {
            Buzzer.Duration = Decimal.ToInt32(numericUpDownDuration.Value);
            Buzzer.Pulse = radioButtonPulse.Checked;
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.Cancel;
        }
    }
}
